/**
 *  @file SocketStream.h
 */
#ifndef _SOCKETSTREAM_H_
#define _SOCKETSTREAM_H_

#include "../io/Stream.h"
#include "Socket.h"

namespace cppflib
{

namespace net
{

class _DLLAPI SocketStream : public io::Stream
{
private:
    Socket *pSock;
    int recvTimeout;

private:
    SocketStream(void);

public:
    SocketStream(Socket *pSock, int recvTimeout);
    virtual ~SocketStream(void);

    virtual void Close();
    virtual void Flush();
    virtual int Read(collections::ArrayByte &buffer);
    virtual int Read(collections::ArrayByte &buffer, int offset, int count);
    virtual int Read();   
    virtual i64_t Seek(i64_t offset, seekorigin_t origin);
    virtual int Write(collections::ArrayByte &buffer);
    virtual int Write(collections::ArrayByte &buffer, int offset, int count);
    virtual bool Write(u8_t val);
};

} // end of namespace net

} // end of namespace cppflib


#endif
